cmake_minimum_required(VERSION 3.16)

project(IntelliEyeLabelAnalysisWin VERSION 0.1 LANGUAGES CXX)

set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 6.2 REQUIRED COMPONENTS Quick)

# 查找依赖库
find_package(Qt6 6.2 REQUIRED COMPONENTS Quick SerialPort Qml Charts)
find_package(yaml-cpp REQUIRED)
find_package(OpenCV REQUIRED)

# 添加源文件和头文件
file(GLOB SRC_FILES ${CMAKE_SOURCE_DIR}/src/*.cpp ${CMAKE_SOURCE_DIR}/src/*.c)
file(GLOB SRC_HEADS ${CMAKE_SOURCE_DIR}/src/*.h)
file(GLOB LIBS ${CMAKE_SOURCE_DIR}/lib/*.so)

#configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_SOURCE_DIR}/src/version.h @ONLY)

include_directories(${CMAKE_SOURCE_DIR}/src)
include_directories(${OpenCV_INCLUDE_DIRS})

link_directories(/opt/MVS/lib/64/)
link_directories(/home/cool/DVP2-Linux64_240614/DVP2-Linux64/)

# 编译可执行文件
qt_add_executable(appIntelliEyeLabelAnalysisWin
    source/main.cpp
    ${SRC_FILES}
#    qml.qrc
#    image.qrc
#    myfonts.qrc
)

file(GLOB_RECURSE QML_FILES ${CMAKE_SOURCE_DIR}/qml/*.qml)
qt_add_qml_module(appIntelliEyeLabelAnalysisWin
    URI IntelliEyeLabelAnalysisWin
    VERSION 1.0
    QML_FILES
        qml/Main.qml
SOURCES source/afterdetect.cpp source/afterdetect.h source/aiimageutils.cpp source/aiimageutils.h source/aipostprocess.cpp source/aipostprocess.h source/aiprocess.cpp source/aiprocess.h source/authorizationtiming.cpp source/authorizationtiming.h source/authorizationtool.cpp source/authorizationtool.h source/AutoPropertyHelper.h source/autorunprocess.cpp source/autorunprocess.h source/autoSettinghelp.h source/camera.cpp source/camera.h source/cameraeth0.cpp source/cameraeth0.h source/camerathread.cpp source/camerathread.h source/camerausb.cpp source/camerausb.h source/chartplotter.cpp source/chartplotter.h source/configadapter.cpp source/configadapter.h source/configmanager.cpp source/configmanager.h source/configmodel.cpp source/configmodel.h source/cvalgedgedetection.cpp source/cvalgedgedetection.h source/cvalgorithm.cpp source/cvalgorithm.h source/CVAlgorithmFactory.h source/cvprocessor.cpp source/cvprocessor.h source/defectstatistics.cpp source/defectstatistics.h source/detectcachemodel.cpp source/detectcachemodel.h source/dualdetect.cpp source/dualdetect.h source/errordialogmanager.cpp source/errordialogmanager.h source/faultcachemodel.cpp source/faultcachemodel.h source/filedeleter.cpp source/filedeleter.h source/fileoperations.cpp source/fileoperations.h source/filereader.cpp source/filereader.h source/floorserial.cpp source/floorserial.h source/floorsetting.cpp source/floorsetting.h source/git2updater.cpp source/git2updater.h source/gitupdater.cpp source/gitupdater.h source/gitupdaterqml.cpp source/gitupdaterqml.h source/gpiocontroller.cpp source/gpiocontroller.h source/hiconVMS.cpp source/identifiimg.cpp source/identifiimg.h source/identtracker.cpp source/identtracker.h source/identtrackerorb.cpp source/identtrackerorb.h source/identtrackertemplate.cpp source/identtrackertemplate.h source/ImageProcessor.cpp source/ImageProcessor.h source/imageprovider.cpp source/imageprovider.h source/imagerecord.cpp source/imagerecord.h source/imagesavemanager.cpp source/imagesavemanager.h source/imagesavethread.cpp source/imagesavethread.h source/kcentergreedycv.cpp source/kcentergreedycv.h source/kcentergreedyint8.cpp source/kcentergreedyint8.h source/logger.cpp source/logger.h source/logReader.cpp source/logReader.h source/main.cpp source/md5.h source/modelstatusmanager.cpp source/modelstatusmanager.h source/mousetracker.cpp source/mousetracker.h source/mousetrackingworker.cpp source/mousetrackingworker.h source/mvhikcamera.cpp source/mvhikcamera.h source/networkmanager.cpp source/networkmanager.h source/networkworker.cpp source/networkworker.h source/ngcard.cpp source/ngcard.h source/ngtable.cpp source/ngtable.h source/parametermodel.cpp source/parametermodel.h source/patchcoreai.cpp source/patchcoreai.h source/pccore.cpp source/pccore.h source/pccoremodel.cpp source/pccoremodel.h source/pccorethread.cpp source/pccorethread.h source/pcdual.cpp source/pcdual.h source/pcfeature.cpp source/pcfeature.h source/popupmanager.cpp source/popupmanager.h source/precisionidentify.cpp source/precisionidentify.h source/preprocessor.cpp source/preprocessor.h source/processtask.cpp source/processtask.h source/quicktool.h source/remotecontrol.cpp source/remotecontrol.h source/resdiff.cpp source/resdiff.h source/rknntool.cpp source/rknntool.h source/schedulingworkthreads.cpp source/schedulingworkthreads.h source/screenShot.cpp source/screenShot.h source/systemmonitor.cpp source/systemmonitor.h source/testrt.cpp source/testrt.h source/tools.cpp source/tools.h source/txrxserial.cpp source/txrxserial.h source/utility.cpp source/Utility.h source/versioninfo.cpp source/versioninfo.h source/VideoPlayer.cpp source/VideoPlayer.h source/wifiscanner.cpp source/wifiscanner.h source/yolodetector.cpp source/yolodetector.h
RESOURCES source/md5.c
)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
set_target_properties(appIntelliEyeLabelAnalysisWin PROPERTIES
#    MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appIntelliEyeLabelAnalysisWin
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)

target_link_libraries(appIntelliEyeLabelAnalysisWin
    PRIVATE Qt6::Quick
)

include(GNUInstallDirs)
install(TARGETS appIntelliEyeLabelAnalysisWin
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
